package com.sfang.common.redis.redisson;

import com.sfang.common.redis.sdk.RedisAtomicLong;
import org.redisson.api.RAtomicLong;
import org.redisson.api.RedissonClient;

public class RedissonAtomicLong implements RedisAtomicLong {

    private final RAtomicLong rAtomicLong;

    public RedissonAtomicLong(RedissonClient redissonClient, String key) {
        rAtomicLong = redissonClient.getAtomicLong(key);
    }

    @Override
    public long incrementAndGet() {
        return rAtomicLong.incrementAndGet();
    }

    @Override
    public long decrementAndGet() {
        return rAtomicLong.decrementAndGet();
    }

    @Override
    public long get() {
        return rAtomicLong.get();
    }

    @Override
    public long getAndAdd(Integer value) {
        return rAtomicLong.getAndAdd(value);
    }
}
